//
//  ExclusiveRegionCollectionViewCell.m
//  DayByDay
//
//  Created by dllo on 16/5/19.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ExclusiveRegionCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@interface ExclusiveRegionCollectionViewCell ()
@property (strong, nonatomic) IBOutlet UIImageView *bgImageV;
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *tiileLabel;
@property (strong, nonatomic) IBOutlet UILabel *timeLabel;

@end


@implementation ExclusiveRegionCollectionViewCell


- (void)setModel:(ExclusiveRegionDataModel *)model {
    _model = model;
    [self.bgImageV sd_setImageWithURL:[NSURL URLWithString:_model.picUrl]];
    self.nameLabel.text = _model.name;
    self.tiileLabel.text = _model.desc;
//    NSString*str=@"1368082020";//时间戳
    NSString *string = [[_model.onlineTime stringValue] substringToIndex:[_model.onlineTime stringValue].length - 3];
    NSTimeInterval time=[string doubleValue];//因为时差问题要加8小时 == 28800 sec
    
    NSDate*detaildate=[NSDate dateWithTimeIntervalSince1970:time];
    
//    NSLog(@"date:%@",[detaildate description]);
    
    //实例化一个NSDateFormatter对象
    
    NSDateFormatter*dateFormatter = [[NSDateFormatter alloc]init];
    
    //设定时间格式,这里可以设置成自己需要的格式
    
    [dateFormatter setDateFormat:@"YYYY.MM.dd"];
    
    NSString*currentDateStr = [dateFormatter stringFromDate:detaildate];
    
    
    self.timeLabel.text = currentDateStr;
}

- (void)awakeFromNib {
    // Initialization code
}

@end
